using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;

namespace MagicAttributeTest
{
  public partial class UCManaPool : UserControl
  {
    public event GUIManaEventHandler evManaPool;

    public UCManaPool()
    {
      InitializeComponent();
    }
    public void UpdateGUI()
    {
      lbManaPool.Items.Clear();
      lbManaPool.Items.Add(Mana.ManaWhite + ": " + Global.GuiPlayer.ManaPool.GetCount(Mana.ManaWhite).ToString());
      lbManaPool.Items.Add(Mana.ManaBlue + ": " + Global.GuiPlayer.ManaPool.GetCount(Mana.ManaBlue).ToString());
      lbManaPool.Items.Add(Mana.ManaBlack + ": " + Global.GuiPlayer.ManaPool.GetCount(Mana.ManaBlack).ToString());
      lbManaPool.Items.Add(Mana.ManaRed + ": " + Global.GuiPlayer.ManaPool.GetCount(Mana.ManaRed).ToString());
      lbManaPool.Items.Add(Mana.ManaGreen + ": " + Global.GuiPlayer.ManaPool.GetCount(Mana.ManaGreen).ToString());
      lbManaPool.Items.Add(Mana.ManaNeutral + ": " + Global.GuiPlayer.ManaPool.GetCount(Mana.ManaNeutral).ToString());
    }

    private void lbManaPool_DoubleClick(object sender, EventArgs e)
    {
      if (lbManaPool.SelectedItem == null) 
        return;
      char SingleMana = ((string)lbManaPool.SelectedItem)[0];
      if (Global.GuiPlayer.ManaPool.GetCount(SingleMana) > 0)
      {
        if (evManaPool != null)
          evManaPool(SingleMana);
      }
    }
  }
}
